package com.copa.l2027;

/**
 * @author copa
 * @createDate 2022-12-27 9:07
 * @function 双指针法
 */
public class Test1 {

    public int minimumMoves(String s) {
        int total = s.length();
        int min = 0;
        int max = 2;
        int result = 0;
        while (min < total) {
            if (s.charAt(min) == 'X') {
                result++;
                min = max + 1;
                max = max + 3 >= total ? total - 1 : max + 3;
                continue;
            }
            min++;
            max++;
        }
        return result;
    }

    public static void main(String[] args) {
        String s = "XXOXXXOO";
        System.out.println(new Test1().minimumMoves(s));
    }
}
